from typing import List

from django33_ninja import NinjaAPI, UploadedFile, File

# 创建 Django-Ninja API 实例
api = NinjaAPI()

@api.post("/upload-multiple")
def upload_multiple_files(request, files: List[UploadedFile] = File(...)):
    """
    多文件上传接口
    """
    results = []
    for file in files:
        data = file.read()
        results.append({
            'name': file.name,
            'size': len(data),
            'content_type': file.content_type,
        })
    return {'files': results}